package leetcode.树;

import java.util.ArrayList;
import java.util.List;

class TreeNode {
    int val;
    TreeNode left;
    TreeNode right;

    TreeNode() {
    }

    TreeNode(int val) {
        this.val = val;
    }

    TreeNode(int val, TreeNode left, TreeNode right) {
        this.val = val;
        this.left = left;
        this.right = right;
    }
}

public class midTree94 {
    private List<Integer> ans = new ArrayList<>();
    public List<Integer> inorderTraversal(TreeNode root) {
        result(root);
        return ans;
    }

    public void result(TreeNode root){
        if(root == null)
            return;
        result(root.left);
        ans.add(root.val);
        result(root.right);
    }

}
